<include file="Member:head" />

<link href="__PUBLIC__/css/member.css" rel="stylesheet" type="text/css" />
<div  class="container w clearfix">
    <include file="Member:right" />
    <div class="member_main">
        <div class="perInfo">
            <div class="titleInfoBorder">
                <span>在线充值</span>
                <a class="want" href="{:U('Member/order')}">充值记录</a>
            </div>

        </div>

        <div class="tishi">
            <p class="tishi_text">
                <span class="tishi_span">优惠活动</span>
            </p>
            <!--           <p class="tishi_text">
                            2018促销活动：【支付宝】充多少金额送<b>10%</b>积分。比如【支付宝】充10元火币送<b>10</b>积分，【支付宝】充10元积分送<b>10</b>积分，【支付宝】充9.6元会员送<b>10</b>积分。活动时间：<b>2018-3-20</b>到<b>2018-3-31</b>。
                        </p>-->
            <p class="tishi_text">
                充值若失败请联系管理员QQ<b>{$Think.config.qq}</b>,立即送您<b>双倍</b>积分（PS：目前充值成功率100%）
            </p>
        </div>
        <form action="{:U('Public/pay')}" method="post" id="form_pay">
            <div class="setting-right-wrap wrap-boxes settings" style="min-height:0">
                <p class="red"><strong style="font-size:20px">积分充值</strong><span style="color:#666;margin-left:10px">(1元 = <b>{$Think.config.points.paybei}</b> 积分)</span></p>
                <div class="setting-wrap setting-profile">
                    <foreach name="pay_points" item="row">
                        <label style="width:250px;display: inline-block"><input <if condition="$row.is_selected eq 1">checked="checked"</if> name="points_item" value="{$row.id}" autocomplete="off"  type="radio"> {$row.money}元<b>/</b>{$row.points}积分        
                            <if condition="$row.vip_month gt 0"><span class="red">+{$row.vip_month}个月VIP</span></if></label>

                    </foreach>
                    <label style="width:150px;display: inline-block"><input  name="points_item" value="custom" autocomplete="off"  type="radio"/> 自定义</label>
                    <div class="wlfg-wrap" id="points_custom_area" style="display: none">
                        <label class="label">充值金额</label>
                        <input type="text" name="money" id="money" value="200" style="width:150px" onkeyup="checkMoney($(this), 1)"  class="form_input" autocomplete="off"/> 元
                        <input type="hidden" name="paytype" value="alipay" checked /> 
                        <span style="color:red;margin:0 0 0 5px" id="points"></span> <span class="unit_name">积分</span>
                    </div>
                </div>
                <div class="setting-wrap setting-profile">
                    <div class="message_item" style="margin-left:65px;">
                        <em class="type">支付方式：</em>
                        <label>
                            <input type="radio" class="message_rd" value="1" id="rd1" name="rd1" checked="checked" />
                            <span class="message_lab"><img src="{$Think.config.url_oss}/images/alipay.png" width="30px" height="30px"></span>
                        </label>
                        <label>
                            <input type="radio" class="message_rd" value="0" id="rd2" name="rd1"  />
                            <span class="message_lab"><img src="{$Think.config.url_oss}/images/wechat.png" width="30px" height="30px"></span>
                        </label>
                       
                        <label>
                            <input type="radio" class="message_rd" value="3" id="rd3" name="rd1"  />
                            <span class="message_lab"><img src="{$Think.config.url_oss}/images/qqqb.png" width="30px" height="30px"></span>
                        </label>
                       
                    </div>
                    <div class="wlfg-wrap" style="margin-top:30px">
                        <label class="label"></label>
                        <button class="btn" style="height: 36px;line-height: 36px;font-size:16px;width:140px" type="button" onclick="subPayForm()" id='btn_submit'>充值积分</button>
                    </div>
                </div>
            </div>
        </form>
       
        <form action="{:U('Public/pay_huobi')}" method="post" id="form_pay3">
            <div class="setting-right-wrap wrap-boxes settings">

                <p class="red"><strong style="font-size:20px">火币充值</strong><span style="color:#666;margin-left:10px">火币和VIP无关，1元 = 1火币</span></p>
                <div class="setting-wrap setting-profile">
                    <div class="wlfg-wrap">

                        <div class="recharge">
                            <foreach name="pay_huobi" item="row">
                                <label style="width:150px;display: inline-block"><input checked="checked" name="huobi_id" value="{$row.id}" autocomplete="off"  type="radio"> {$row.money}元<b>/</b>{$row.points}火币</label>
                            </foreach>
                            <label style="width:150px;display: inline-block"><input  name="huobi_id" value="custom" autocomplete="off"  type="radio"/> 自定义</label>
                            <div class="wlfg-wrap" id="points_custom_area2" style="display: none">
                                <label class="label">充值金额</label>
                                <input type="text" name="money2" id="money2" value="10" style="width:150px" onkeyup="checkMoney2()"  class="form_input" autocomplete="off"/> 元

                                <span style="color:red;margin:0 0 0 5px" id="points2"></span> <span class="unit_name">火币</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="setting-wrap setting-profile">
                    <div class="message_item" style="margin-left:65px;">
                        <em class="type">支付方式：</em>
                        <label>
                            <input type="radio" class="message_rd" value="1" name="rd3" checked="checked" />
                            <span class="message_lab" for="rd1"><img src="{$Think.config.url_oss}/images/alipay.png" width="30px" height="30px"></span>
                        </label>
                        <label>
                            <input type="radio" class="message_rd" value="0" name="rd3"  />
                            <span class="message_lab" for="rd2"><img src="{$Think.config.url_oss}/images/wechat.png" width="30px" height="30px"></span>
                        </label>
                        
                         <label>
                            <input type="radio" class="message_rd" value="3"  name="rd3"  />
                            <span class="message_lab" for="rd3"><img src="{$Think.config.url_oss}/images/qqqb.png" width="30px" height="30px"></span>
                        </label>
                                
                    </div>
                    <input type="hidden" name="paytype" value="alipay" checked /> 
                    <div class="wlfg-wrap" style="margin-top:30px">
                        <label class="label"></label>
                        <button class="btn" style="height: 36px;line-height: 36px;font-size:16px;width:140px" type="button" onclick="subPayForm3()" id='btn_submit'>充值火币</button>
                    </div>
                </div>
            </div>
        </form>
         <form action="{:U('Public/pay_month')}" method="post" id="form_pay2">
            <div class="setting-right-wrap wrap-boxes settings">

                <p class="red"><strong style="font-size:20px">开通vip</strong> <span style="color:#666;margin-left:10px">(非原创免积分，原创一半积分)</span> <a href="http://www.sucaihuo.com/topic/187.html" target="_blank">VIP说明</a></p>
                <p style="color:#666;">VIP特权：网页特效、网站模板、PHP/Mysql、视频教程、整站源码有售后，非VIP：视频教程、整站源码（火币）有售后</p>
                <div class="setting-wrap setting-profile">
                    <div class="wlfg-wrap">

                        <div class="recharge">
                            <foreach name="pay_month" item="row">
                                <label <if condition="$row.id eq 8"> style="width:200px;display: inline-block"<else/> style="width:150px;display: inline-block"</if>><input checked="checked" name="month" value="{$row.id}" autocomplete="off"  type="radio"> {$row.money}元<b>/</b>{$row.name}</label>
                            </foreach>
                        </div>
                    </div>
                </div>
                <div class="setting-wrap setting-profile">
                    <div class="message_item" style="margin-left:65px;">
                        <em class="type">支付方式：</em>
                        <label>
                            <input type="radio" class="message_rd" value="1" name="rd2" checked="checked" />
                            <span class="message_lab" for="rd1"><img src="{$Think.config.url_oss}/images/alipay.png" width="30px" height="30px"></span>
                        </label>
                        <label>
                            <input type="radio" class="message_rd" value="0" name="rd2"  />
                            <span class="message_lab" for="rd2"><img src="{$Think.config.url_oss}/images/wechat.png" width="30px" height="30px"></span>
                        </label>
                        <label>
                            <input type="radio" class="message_rd" value="3" name="rd2"  />
                            <span class="message_lab" for="rd3"><img src="{$Think.config.url_oss}/images/qqqb.png" width="30px" height="30px"></span>
                        </label>
                    </div>
                    <input type="hidden" name="paytype" value="alipay" checked /> 
                    <div class="wlfg-wrap" style="margin-top:30px">
                        <label class="label"></label>
                        <button class="btn" style="height: 36px;line-height: 36px;font-size:16px;width:140px" type="button" onclick="subPayForm2()" id='btn_submit'>充值会员</button>
                    </div>
                </div>
            </div>
        </form>
        <include file="Member:menu" />
    </div>
</div>

<include file="Member:foot" />
<script>
    var bei = parseInt("{$Think.config.points.paybei}");

    function checkMoney() {
        var money = $("#money").val();
        if (isNaN(money) == true || parseInt(money) < 1) {
            $("#money").val(10);
        }
        var money = getPoints(parseInt($("#money").val()));

        $("#points").text(money * bei);
    }
    function checkMoney2() {
        var money = $("#money2").val();
        if (isNaN(money) == true || parseInt(money) < 1) {
            $("#money2").val(10);
        }
        var money = parseInt($("#money2").val());

        $("#points2").text(money);
    }
    function subPayForm() {
        var money = $("#money").val();
        var points_item = $("input[name=points_item]:checked").val();
        if (points_item == 'custom') {
            if (money >= 5) {
            } else {
                alert("最低充值金额5元！");
                return false;
            }

        }
        var rd = $('input[name=rd1]:checked').val();
        if (rd == 1) {
            $("#form_pay").submit();
        } else if (rd == 3) {
            $("#form_pay").attr('action', '__APP__/Qqpay/points');
        } else {
            $('#form_pay').attr('action', '__APP__/Public/wxpay_points');
        }
        $("#form_pay").submit();
    }

    $(function() {
        var money = checkMoney();
        $("#points").text(money);
        $("input[name=points_item]").click(function() {
            var val = $(this).val();
            if (val == 'custom') {
                $("#points_custom_area").show();
            } else {
                $("#points_custom_area").hide();
            }
        })

        var money2 = checkMoney2();
        $("#points2").text(money2);
        $("input[name=huobi_id]").click(function() {
            var val = $(this).val();
            if (val == 'custom') {
                $("#points_custom_area2").show();
            } else {
                $("#points_custom_area2").hide();
            }
        })
    })
    function getPoints(money) {
        if (money >= 200) {
            money = money * 2;
        }
        return money;
    }
    function getMoney(money) {

        if (money >= 100 && money < 200) {
            money = money + 10;
        } else if (money >= 200) {
            money = money + 30;
        }
        return money;
    }
    function subPayForm2() {

        var rd = $('input[name=rd2]:checked').val();
        if (rd == 1) {
            $("#form_pay2").submit();
        } else if (rd == 3) {
            $("#form_pay2").attr('action', '__APP__/Qqpay/month');
        } else {
            $('#form_pay2').attr('action', '__APP__/Public/wxpay');
        }
        $("#form_pay2").submit();
    }
    function subPayForm3() {

        var rd = $('input[name=rd3]:checked').val();

        if (rd == 1) {
            $("#form_pay3").submit();
        } else if (rd == 3) {
            $("#form_pay3").attr('action', '__APP__/Qqpay/huobi');
        } else {
            $('#form_pay3').attr('action', '__APP__/Public/wxpay_huobi');
        }
        $("#form_pay3").submit();
    }
</script>
